// 获取a数组中不在b数组中的元素
// difference( [3,4], [1,2,3] ) // [4]
const difference = (a, b) => {
    const s = new Set(b);
    return a.filter(x => !s.has(x));
}

// 两数组的交集
const intersection = (a, b) => {
    const s = new Set(b);
    return a.filter(x => s.has(x));
}


module.exports = {
    difference, intersection
}
